<?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

return new class extends Migration
{
  /**
   * Run the migrations.
   *
   * @return void
   */
  public function up() : void
  {
    Schema::create('module_complain', function (Blueprint $table) {
      $table->id()->comment('自增编号');
      $table->unsignedInteger('organization_id')->comment('机构编号')->default(0);
      $table->unsignedInteger('category_id')->comment('分类编号')->default(0);
      $table->unsignedInteger('member_id')->comment('会员编号')->default(0);
      $table->string('content', 500)->comment('投诉内容')->default('');
      $table->unsignedTinyInteger('read_status')->comment('是否阅读 0:未读 1:已读')->default(1);
      $table->unsignedTinyInteger('status')->comment('状态 1:正常, 2:异常, -1:删除')->default(1);
      $table->unsignedInteger('create_time')->comment('创建时间')->default(0);
      $table->unsignedInteger('update_time')->comment('更新时间')->default(0);

      $table->index(['category_id', 'member_id']);
      $table->index('organization_id');
    });
  }

  /**
   * Reverse the migrations.
   *
   * @return void
   */
  public function down()
  {
    Schema::dropIfExists('module_complain');
  }
}
